package com.ldc.commonres.common

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.ldc.commonlibs.common.ViewModelBase

abstract class VBMFragment<VB : ViewBinding, VM : ViewModelBase> : VBFragment<VB>() {
    open var viewModel: VM? = null


    override fun loadViewBinding(inflater: LayoutInflater, container: ViewGroup?): VB {
        val vb: VB = super.loadViewBinding(inflater, container)
        viewModel = loadViewModel()
        return vb
    }


    open fun loadViewModel(): VM = createViewModel()
    protected abstract fun createViewModel(): VM


}
